public class demo7 {

        public static void main(String[] args) {
            Thread t1=new Thread(()->{
                for (int i = 0; i < 5; i++) {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
                System.out.println("t1结束");
            });

            Thread t2=new Thread(()->{
                try {
                    t1.join(100);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("t2结束");
            });

            t1.start();
            t2.start();
            System.out.println("main结束");

        }
    }


